<template>
  <div class="theme">
    <app-navigator defaultPath="normal/button" ref="navigator">
      <article class="app-home">
        <section class="app-header" @click="goHome">cv-ui</section>
        <section class="app-menu">
          <app-menu></app-menu>
        </section>
        <section class="app-content">
          <app-navigator-page />
        </section>
      </article>
    </app-navigator>
  </div>
</template>

<script lang="ts">
import { AppNavigator } from "./components/navigator/app-navigator";
import { AppNavigatorPage } from "./components/navigator/app-navigator-page";
import AppMenu from "./components/app/app-menu.vue";
import { defineComponent } from "vue";

export default defineComponent({
  name: "app",
  components: {
    AppNavigator,
    AppNavigatorPage,
    AppMenu
  },
  setup() {
    const navigator = AppNavigator.use.ref("navigator");
    const goHome = () => {
      (navigator.value as any).methods.go("/home");      
    }
    return {
      goHome
    };
  }
});
</script>

<style lang="scss">
$headSize: 60px;
$menuSize: 300px;

.app-home {
  .app-header {
    height: $headSize;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    border-bottom: 1px solid #ccc;
    box-sizing: border-box;
    display: flex;
    font-size: 20px;
    font-weight: bold;
    font-style: italic;
    padding: 0 40px;
    color: #42b983;
    background-color: #fff;
  }
  .app-menu {
    position: fixed;
    top: $headSize;
    left: 0;
    width: $menuSize;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid #ccc;
  }

  .app-content {
    padding-top: $headSize + 20px;
    padding-left: $menuSize + 20px;
    box-sizing: border-box;
  }
}
</style>
